#include<bits/stdc++.h>

using namespace std;

int main() {
    int a[] = {1, 6, 2, 5, 1, 2, 3, -99, 123456};
    int n = sizeof(a) / sizeof(a[0]);
    sort(a, a + n);
    copy(a, a + n, ostream_iterator<int>(cout, " "));
    cout << endl;
    int m = unique(a, a + n) - a;

    copy(a, a + m, ostream_iterator<int>(cout, " "));
    cout << endl;
    return 0;
}
